#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int S = 1 << 8;
const int mod = 1e9+7;

struct matrix{
	ll arr[S][S];
	int sz;
	matrix(int x = 0){memset(arr,0,sizeof(arr));sz = x;}
	const ll * operator [] (const int x)const{return arr[x];}
	ll * operator [](int x){return arr[x];}
	friend matrix operator * (matrix a,matrix b){
		matrix c(a.sz);
		for(int i = 0;i < c.sz;i++)
			for(int j = 0;j < c.sz;j++)
				if(a[i][j])
					for(int k = 0;k < c.sz;k++)
						(c[i][k] += a[i][j] * b[j][k] % mod) %= mod;
		return c;
	}
}m,x;

int a[10];

matrix qp(matrix x,int t){matrix res(x.sz); for(int i = 0;i < res.sz;i++) res[i][i] = 1;for(;t;t>>=1,x=x*x)if(t&1)res=res*x;return res;}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	for(int i = 0;i < 7;i++) a[i] = in;
	m = matrix(2); m[0][0] = 0; m[0][1] = 1;
	for(int i = 0;i < 7;i++){
		int lim = 1 << i + 1; x = matrix(lim); //cerr<<m.sz<<".."<<lim<<endl;
		for(int s = 0;s < lim;s++)
			for(int t = 0;t < lim;t++){
				int cc = 0;
				for(int bl = 0;bl < 1 << i;bl++){
					bool fl = 1; if(i == 0 && s == 1 && t == 1) fl = 0;
					for(int j = 0;j <= i && fl;j++){
						if(s >> j & 1 && t >> j & 1){
							if(j == 0 && bl >> j & 1) fl = 0;
							if(j == i && bl >> j - 1 & 1) fl = 0;
							if(j > 0 && j < i && bl >> j & 1 && bl >> j - 1 & 1) fl = 0;
						}
					}
					cc+=fl; //if(fl) cerr<<"!"<<endl;
				}
				x[s][t] = cc;
//				if(i == 5 && s == 23 && t == 13) cerr<<s<<".."<<t<<".."<<cc<<endl;
			}
		
/*		for(int k = 0;k < m.sz;k++) cerr<<m[0][k]<<"..";
		cout<<endl;
*/		m = m * qp(x,a[i]);
/*		for(int k = 0;k < m.sz;k++) cerr<<m[0][k]<<"..";
		cout<<endl;
*/		for(int s = 0;s < lim;s++){m[0][s + lim] = m[0][s]; m[0][s] = 0;/*cerr<<s+lim<<":"<<m[0][s+lim]<<endl;*/}
		m.sz <<= 1;
	}
	ll ans = m[0][m.sz-1]; printf("%lld\n",ans);
	return 0;
}
